package insight.google.game.era.core.hub;

import insight.google.game.era.bo.GameUser;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

import com.google.appengine.api.datastore.Key;

public class UserPendingEvents implements Serializable {

//	String userName;
//	String roomName;
	Key userId;
	
	List<PendingEvents> eventList = new ArrayList<PendingEvents>();

//	public String getUserName() {
//		return userName;
//	}
//	public void setUserName(String userName) {
//		this.userName = userName;
//	}
//	public String getRoomName() {
//		return roomName;
//	}
//	public void setRoomName(String roomName) {
//		this.roomName = roomName;
//	}
	
	
	
	
	public List<PendingEvents> getEventList() {
		return eventList;
	}
	public Key getUserId() {
		return userId;
	}
	public void setUserId(Key userId) {
		this.userId = userId;
	}
	public void setEventList(List<PendingEvents> eventList) {
		this.eventList = eventList;
	}
	
	
	public synchronized boolean  processPendingEvents(GameUser user){
		if(this.eventList == null || eventList.size() <= 0) return true;
		for (PendingEvents pendingEvent : eventList) {
			pendingEvent.processPendingEvents(user);
//			eventList.remove(pendingEvent);
		}
		eventList = new ArrayList<PendingEvents>();
		
		return true;
	}
	
	
	
}
